package com.tinckay.entity.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;

import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;

import java.io.Serializable;

import com.tinckay.common.constant.ProjectConstant;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;
import org.springframework.data.annotation.Transient;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

/**
 * <p>
 *
 * </p>
 *
 * @author Jean
 * @since 2018-10-24
 */
@Data
@TableName("pour_tran_process")
@ApiModel(value = "TranProcess对象", description = "运输过程")
public class TranProcess extends Model<TranProcess> {

    private static final long serialVersionUID = 6706191438620909968L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @ApiModelProperty(value = "任务id")
    private Long taskId;

    @NotNull(message = "开始时间不能为空", groups = ProjectConstant.Save.class)
    @ApiModelProperty(value = "开始时间")
    private LocalDateTime startTime;

    @NotNull(message = "结束时间不能为空", groups = ProjectConstant.Save.class)
    @ApiModelProperty(value = "结束时间")
    private LocalDateTime endTime;

    @ApiModelProperty(value = "总耗时（秒）")
    private Long consumeTime;

    @Range(min = 0, max = 5, message = "运输过程状态有误", groups = ProjectConstant.Save.class)
    @ApiModelProperty(value = "1装料 2运输 3卸料 4卸料暂停 5返回，传0表示开始运输（新增运输任务）")
    private Integer processType;

    @ApiModelProperty(hidden = true)
    @TableField(value = "dataTime", fill = FieldFill.INSERT)
    private LocalDateTime dataTime;

    @ApiModelProperty(value = "创建时间", hidden = true)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "更新时间", hidden = true)
    private LocalDateTime updateTime;

    @TableField(exist = false)
    private String storeHouseCode;

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
